// app/model/supplier.js
module.exports = app => {
  const { STRING, TEXT } = app.Sequelize;

  return app.model.define('supplier', {
    name: {
      type: STRING(100),
      comment: '供应商全称'
    },
    credit_code: {
      type: STRING(64),
      comment: '加密后的统一信用代码'
    },
    risk_level: {
      type: INTEGER,
      defaultValue: 0,
      comment: '0-未评估 1-低风险 2-中风险 3-高风险'
    }
  }, {
    indexes: [
      { fields: ['province_code'] },
      { fields: ['risk_level'] }
    ]
  });
};